<% for column in Bug.content_columns %>
<p>
  <b><%= column.human_name %>:</b> <%=h @bug.send(column.name) %>
</p>
<% end %>

<b>Assigned to:</b>
<br>
<%= link_to @bug.user.login, :controller => 'users', :action => 'show', :id => @bug.user.id %>
</br>
</br>
<%
users = User.find(:all)
%>
<h2> Comments </h2>
<div id="comments_list"> 
    <%= render_partial "comments"%>
</div>




<h3> Add comment</h3>
    
    <%= form_remote_tag( 
            :update => "comments_list",
            :url => {:controller => "bugs", :action => "add_comment" } 
            ) %>
    
    
    Your comment:<br />
    <textarea name="comment[content]" cols="40" rows="10"></textarea> <br />
    <input type="hidden" name="comment[bug_id]" value="<%=@bug.id%>" />
    <input type="submit" value="Add Comment"/>
<%= end_form_tag %>




<b>Assign to:</b>
<br>
<ul>
<%
for user in users
%>
<li>
<%= link_to user.login, :controller => 'bugs', :action => 'assign', :bug_id => @bug.id, :user_id => user.id %>

</li>
</br>
<%
end
%>
</ul>
</br>

<b>Assignment history:</b>
<table>
<tr><th>Date</th><th>From</th><th>To</th></tr>
<%
histories = BugHistory.find(:all, :conditions => ["bug_id = ?",@bug.id])

userFrom = ""
for history in histories
userTo = User.find(history.user_id).login
%>
<tr class="row2"><td><%=history.created_at%></td><td><%=userFrom%></td><td><%=userTo%></td></tr>
<%
userFrom = User.find(history.user_id).login
end
%>
</table>

<%= link_to 'Edit', :action => 'edit', :id => @bug %> |
<%= link_to 'Back', :action => 'list' %>
